<template>
  <view>
    <view class="Openbox">
    <view class="boxcount">
      <view class="obtainbox">
         <image src="/static/title-box.png" alt="" />
      </view>
      <view class="imgbox">
          <!-- <image src="" alt=""> -->
          <image src="/static/xinkong.png" alt="" />
          <view class="mystery_box ">
            <image src="/static/box2.png" alt="" />
          </view>
      </view>
      <view class="btnok" @click="btnok">立即开盒</view>
    </view>
    <view class="Openlater" @click="cancel">稍后打开</view>
    </view>
  </view>
</template>

<script>
import { getOpeningthebox } from "../../../config/api-java";
export default {
  props: {
    id: {
      type: String,
      required: true,
    },
  },
  data() {
    return {};
  },
  methods: {
    async btnok() {
      console.log("开盒");
      let res = await getOpeningthebox({ detailId: this.id });
      console.log(30, res);
      if (res.productType === "shop") {
        this.$emit("goaffirm", res);
      } else {
        this.$emit("unfold", res);
      }
    },
    cancel() {
      this.$emit("padlock");
    },
  },
};
</script>

<style lang="scss" scoped>
page {
  height: 100%;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.185);
}
.boxcount {
  width: 750rpx;
  height: 744rpx;
  padding-top: 206rpx;
  //   margin-top: 206rpx;
  //   background-color: pink;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  .obtainbox {
    width: 537rpx;
    height: 88rpx;
    line-height: 88rpx;

    image {
      width: 100%;
      height: 100%;
    }
  }
  .imgbox {
    position: relative;
    width: 642rpx;
    height: 502rpx;
    image {
      width: 100%;
      height: 100%;
    }
    .mystery_box {
      position: absolute;
      top: 0;
      width: 642rpx;
      height: 502rpx;
      // background-color: pink;
      .image {
        width: 100%;
        height: 100%;
      }
    }
  }
  .btnok {
    width: 436rpx;
    height: 110rpx;
    font-size: 32rpx;
    color: #fff;
    text-align: center;
    line-height: 110rpx;
    border-radius: 55rpx;
    background: url("/static/tag_ac.png") center;
  }
}
.Openlater {
  width: 128rpx;
  height: 45rpx;
  font-size: 32rpx;
  color: #fff;
  margin: 45rpx auto auto auto;
}
</style>
